package com.example.rab.controller;

import com.example.rab.annotation.PermissionAnnotation;
import com.example.rab.entity.domain.Good;
import com.example.rab.service.GoodService;
import com.example.rab.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @projectName: zzhMain
 * @package: com.example.rab.controller
 * @className: GoodController
 * @author: zzh
 * @description: TODO
 * @version: 1.0
 */
@RestController
@RequestMapping("/wx")
@Slf4j
public class GoodController {
    @Resource
    GoodService goodService;

    @PermissionAnnotation
    @PostMapping("/goodList")
    public R GoodList(@RequestBody Map<String, Object> map) {
        return R.success(goodService.GoodList(map));
    }

    @PermissionAnnotation
    @PostMapping("/goodInsert")
    public R GoodInsert(@RequestBody Good good) {
        return R.success(goodService.GoodInsert(good));
    }
}
